using Crux.Core.MongoDb;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;

namespace System;
/// <summary>
/// MongoDbServiceCollectionExtension
/// </summary>
public static class MongoDbServiceCollectionExtension
{
    /// <summary>
    ///
    /// </summary>
    /// <param name="services"></param>
    /// <returns></returns>
    public static IServiceCollection AddMongoDb(
       this IServiceCollection services)
    {
        services.TryAddSingleton(typeof(IMongoDbConnectionHelm<>), typeof(MongoDbConnectionHelm<>));
        services.TryAddScoped(typeof(IMongoDbResolver), typeof(MongoDbResolver));
        services.TryAddScoped(typeof(IMongoUnitOfWork<>), typeof(MongoUnitOfWork<>));
        services.TryAddScoped(typeof(IMongoRepositoryBase<,,>), typeof(MongoRepositoryBase<,,>));
        return services;
    }
}